This invention relates in general to color printer technology and, more particularly, to a system and method for simplifying overlapping shapes for printing.
Many computer applications perform a gradient fill of an area by using rectangles of varying colors. Some of these applications create the gradient fill for a shape as a series of three layers. This approach is a simple method for allowing the applications to use a single algorithm for all shapes of gradient.
FIGS. 1-3 illustrate the typical three-layer approach for a gradient fill. A first layer 2 is a general-purpose gradient drawn with an exclusive OR (XOR) raster operation (ROP). First layer 2 is shown with hatch lines to indicate a color. The color of first layer 2 is the desired color of the gradient.
A second layer 4 is drawn in black with a source (SRC) ROP and acts to mask the desired final shape of the gradient. A third layer 6 is another general-purpose gradient drawn with an XOR ROP. Third layer 6 is the same shape, color, and size as first layer 2. FIG. 3 shows the result of the three layers. The remaining portion of third layer 6 is also shown with hatch lines to indicate a color.
Every shape to be drawn is composed of pixels. Each pixel drawn with an XOR ROP will cancel out any other pixel drawn with an XOR ROP that it overlaps which is the same color. Each pixel drawn with an SRC ROP will simply overwrite any pixel that it overlaps.
In areas where there is no mask 4 drawn, the two layers of general-purpose gradient 2, 6 cancel each other out, leaving no marks to be printed on a page. In areas where the mask 4 is drawn, the first XOR layer 2 is overwritten with black. The result is that the second XOR layer 6 is written on the page.
One drawback to this approach is that a printer is required to process each of the three layers before printing, even though some of the layers have no impact on the printed page. For a 600 dot per inch (dpi) image at 24 bits-per-pixel on an 8xc2xd by 11 inch page with xc2xc inch margins, each layer includes about 30 million pixels. Together the three layers include about 90 million pixels.
According to principles of the present invention, a system and method simplify shapes for printing. A first shape is received by a printer driver. The first shape is stored in a temporary storage cache. A second shape is received by the printer driver. The first shape is compared to the second shape. The first and second shapes are divided into overlapping and non-overlapping portions. The non-overlapping portions of the first shape are re-cached. The non-overlapping portions of the second shape are buffered until they are processed. The overlapping portions of the first and second shapes are simplified.
According to further principles of the present invention, the overlapping portions of the first and second shapes are simplified by evaluating the raster operation (ROP) for each shape and retaining the resulting overlapping portions of each shape.
Other objects, advantages, and capabilities of the present invention will become more apparent as the description proceeds.